﻿using PetaPoco;
using System.Configuration;
using System.Data.SqlClient;

namespace Pangeo.Admin.Consoles
{
    internal class Program
    {
        static void Main(string[] args)
        {
            // 数据库连接字符串
            string connectionString = "Server=192.168.120.252;Database=getrag;User ID=sa;Password=getrag2009;";

            try
            {
                var db = new Database(connectionString, "System.Data.Odbc");
                var count = db.ExecuteScalar<int>("select count(*) from products");
                Console.WriteLine(count);
            }
            catch (Exception ex)
            {
                Console.WriteLine("连接数据库出错: " + ex.Message);
            }

            Console.ReadLine();
        }
    }
}
